package com.ileaf.java8;

import java.math.BigDecimal;

/**
 * @author Lianlb
 * @date 2019-04-19 10:48
 */
public class MathUtil {

    /**
     * 去掉末尾多余零
     */
    public static double removeZeros(double param) {
        BigDecimal decimal = new BigDecimal(String.valueOf(param)).stripTrailingZeros();
        return decimal.doubleValue();
    }

    public static void main(String[] args) {
        double param = 3.00236010;
        System.out.println(removeZeros(param));
    }
}
